d = {}
def f():
arr = []
for item in range(10):
arr.append(str(item))
for item in range(ord('A'), ord('Z') + 1):
arr.append(chr(item))
for item in range(ord('a'), ord('z') + 1):
arr.append(chr(item))
arr.append('-')
arr.append('_')
for i, item in enumerate(arr):
d[item] = '{0:06b}'.format(i).count('0')
f()
ans = 0
s = input()
for ele in s:
ans += d[ele]
final = 3 ** ans % (10 ** 9 + 7)
print(final)
// Problem: C. Vanya and Label
// Contest: Codeforces - Codeforces Round #355 (Div. 2)
// URL: https://codeforces.com/contest/677/problem/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
/*
Author: MikiMiku
Observation:
Idea:
*/
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define endl '\n'
#define sza(x) ((int)x.size())
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define LSB(S) (S & (-S))
#define setAll(S, n) (S = (1 << n) - 1)
#define modulo(S, N) ((S) & (N - 1)) // returns S % N, where N is a power of 2
#define isPowerOfTwo(S) (!(S & (S - 1)))
#define nearestPowerOfTwo(S) ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))
#define turnOffLastBit(S) ((S) & (S - 1))
#define turnOnLastZero(S) ((S) | (S + 1))
#define turnOffLastConsecutiveBits(S) ((S) & (S + 1))
#define turnOnLastConsecutiveZeroes(S) ((S) | (S - 1))
typedef complex<double> point;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const int MAX_N = 1e5 + 5;
const ll MOD = 1e9 + 7;
const int FMOD = 998244353;
const ll INF = 1e9;
const ld EPS = 1e-9;
const double PI=acos(-1);
#define fi first
#define se second
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef map<int,int> mii;
//FLOAT PRECISION SETTINGS
/*
cout.setf(ios::fixed,ios::floatfield);
cout.precision(3);
*/
//FILE IO
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
//........................................................................
ll fexp(ll b, ll e) {
ll mul = b;
ll res = 1;
while(e > 0) {
if(e%2==1) res *= mul;
mul *= mul; mul %= MOD;
res %= MOD;
e /= 2;
}
return res;
}
signed main() {
ios_base::sync_with_stdio(0);cin.tie(nullptr); cout.tie(nullptr);
map<char, int> mc;
vector<char> vc;
int id = 0;
for(char c = '0'; c <= '9'; ++c) vc.pb(c);
for(char c = 'A'; c <= 'Z'; ++c) vc.pb(c);
for(char c = 'a'; c <= 'z'; ++c) vc.pb(c);
vc.pb('-'); vc.pb('_');
int sz = sza(vc);
for(int i = 0; i < sz; ++i) {
mc[vc[i]] = 6 - __builtin_popcount(i);
mc[vc[i]] = fexp(3, mc[vc[i]]);
}
string s;
cin >> s;
ll ans = 1;
for(auto c : s) {
//cerr << c << " " << mc[c] << endl;
ans *= mc[c];
ans %= MOD;
}
cout << ans << endl;
return 0;
}
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |
Lift queries | Goki and his breakup |
Ali and Helping innocent people | Book of Potion making |
Duration | Birthday Party |